package team.archai.nexus.boot.web.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.Optional;

/**
 * @program: tiny-dust-boot-build
 * @description: http请求实体
 * @author: lishibin
 * @create: 2020-07-21 15:52
 **/
@Getter
@Setter
@Schema(description = "通用请求实体")
public class RequestModel<T> {

    @Schema(description = "当前页默认1")
    private Integer current;
    @Schema(description = "分页大小默认10")
    private Integer size;
    @Schema(description = "查询参数")
    private T t;

    public Integer getCurrent() {
        return Optional.ofNullable(current).orElse(1);
    }

    public Integer getSize() {
        return Optional.ofNullable(size).orElse(10);
    }
}
